package com.heima.admin.controller.v1;

import com.heima.admin.service.SensitiveService;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.enums.AppHttpCodeEnum;
import com.heima.model.wemedia.pojos.WmSensitive;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Xiao
 * @version 1.0
 * @description
 * @date 2021/11/29
 */
@RestController
@RequestMapping("/api/v1/sensitive")
public class SensitiveController {
    @Autowired
    private SensitiveService sensitiveService;

    /**
     * 查询敏感词列表
     * @param dto
     * @return
     */
    @PostMapping("/list")
    public ResponseResult getList(@RequestBody SensitiveDto dto) {
        return sensitiveService.getList(dto);
    }

    /**
     * 删除敏感词
     * @param id
     * @return
     */
    @DeleteMapping("/del/{id}")
    public ResponseResult delSensitive(@PathVariable Integer id) {
        return sensitiveService.delSensitive(id);
    }

    /**
     * 添加敏感词
     * @param adSensitive
     * @return
     */
    @PostMapping("/save")
    public ResponseResult saveSensitive(@RequestBody WmSensitive adSensitive) {
        return sensitiveService.saveSensitive(adSensitive);
    }

    /**
     * 修改敏感词
     * @param adSensitive
     * @return
     */
    @PostMapping("/update")
    public ResponseResult updateSensitive(@RequestBody WmSensitive adSensitive) {
        return sensitiveService.updateSensitive(adSensitive);
    }
}
